﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace PHMEE.Migrations
{
    /// <inheritdoc />
    public partial class addFTemplate : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropPrimaryKey(
                name: "PK_AppAppWaveIntervals",
                table: "AppAppWaveIntervals");

            migrationBuilder.RenameTable(
                name: "AppAppWaveIntervals",
                newName: "AppWaveIntervals");

            migrationBuilder.AddPrimaryKey(
                name: "PK_AppWaveIntervals",
                table: "AppWaveIntervals",
                column: "Id");

            migrationBuilder.CreateTable(
                name: "AppFlowmeterTemplates",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    TemplateMode = table.Column<int>(type: "int", nullable: false),
                    FlowmeterName = table.Column<string>(type: "longtext", nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    DeviceType = table.Column<int>(type: "int", nullable: false),
                    IsInlet = table.Column<bool>(type: "tinyint(1)", nullable: false),
                    Remark = table.Column<string>(type: "longtext", nullable: true)
                        .Annotation("MySql:CharSet", "utf8mb4")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppFlowmeterTemplates", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "AppFlowmeterTemplates");

            migrationBuilder.DropPrimaryKey(
                name: "PK_AppWaveIntervals",
                table: "AppWaveIntervals");

            migrationBuilder.RenameTable(
                name: "AppWaveIntervals",
                newName: "AppAppWaveIntervals");

            migrationBuilder.AddPrimaryKey(
                name: "PK_AppAppWaveIntervals",
                table: "AppAppWaveIntervals",
                column: "Id");
        }
    }
}
